package generics.enumtype;

import org.junit.Test;

import java.util.HashSet;
import java.util.Set;

public class Herb {
    public Herb(String name, Type type) {
        this.name = name;
        this.type = type;
    }
    @Override
    public String toString(){
        return  name;
    }

    public enum Type {Annual, perennial,biennial}

    private final String name;
    private final Type type;

    @Test
    public void test() {
        Herb []graden = new Herb[]{};
        Set<Herb>[] herbsByType = new Set[Type.values().length];
        for (Set<Herb> row : herbsByType) {
            row = new HashSet<>();
        }
        for (Herb h : graden) {
            herbsByType[h.type.ordinal()].add(h);
        }
    }
}
